package com.tang.param_check.aspect.handler;

import com.tang.param_check.domain.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Collection;
import java.util.Objects;

/**
 * @Author tangyuan2meicloud.com
 * @DATE 2021/12/17 20:06
 * @Desc
 * @Remarks
 */
@Slf4j
@Component
public class UserAfterHandler implements ParamCheckThenAfterHandle<User> {

    @Override
    public boolean handle(User user) {
        if (Objects.isNull(user)){
            return false;
        }
        return true;
    }

    @Override
    public boolean handleCollection(Collection<User> param) {
        log.info("UserAfterHandler # handleCollection开始执行");
        return true;
    }


    @Override
    public void afterDomainCheck(User param) {
        log.info("单个实例的后置打印！！！！！");
    }

    @Override
    public void afterCollectionCheck(Collection<User> param) {
        log.info("集合实例的后置打印！！！！！");
    }
}
